package com.aabte.design2.structural.proxy;

import java.util.Collection;

/**
 * 之前直接与服务对象交互的 GUI 类不需要改变，前提是它仅通过接口与服务对
 * 象交互。我们可以安全地传递一个代理对象来代替真实服务对象，因为它们都实
 * 现了相同的接口。
 *
 * @author Daniel
 * @version 1.0
 * @date 2020/5/3
 */
public class TVManager {

    private RemotePartyTVLib service;

    public TVManager(RemotePartyTVLib service) {
        this.service = service;
    }

    public void renderVideoPage(int id) {
        Video videoInfo = service.getVideoInfo(id);
        System.out.println("render videoInfo = " + videoInfo);
    }

    public void renderListPanel() {
        Collection<Video> videos = service.listVideos();
        System.out.println("render videos = " + videos);
    }

    public void reactOnUserInput(int id) {
        renderVideoPage(id);
        renderListPanel();
    }

}
